package com.chant.startFarming.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

@Configuration
@EnableSwagger2
public class Swagger2 {
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .groupName("chant")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.chant.startFarming"))
                .build();
    }


    // 配置Swagger信息：apiInfo
    private ApiInfo apiInfo() {
        //作者信息
        Contact contact = new Contact("chant", "https://gitee.com/chant_96", "123@qq.com");

        return new ApiInfo(
                "chant的Swagger API文档",
                "天天加班",
                "v1.0",
                "https://gitee.com/chant_96",
                contact,
                "Apache 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0",
                new ArrayList());

    }
}
